from django.db import models

# Create your models here.
import datetime

from django.db import models
from django.contrib.auth.models import User
import time
import uuid
from django.utils.timezone import now


# Create your models here.
# class Person(models.Model):
#     f = models.CharField(max_length=10)
#     l = models.CharField(max_length=10)
#     s = models.CharField(default='sss', max_length=10)


class autoUploadedAPI(models.Model):
    """存储通过mitmproxy抓包后自动上传的接口"""
    # Id = models.AutoField('ID', primary_key=True, editable=False)
    createTime = models.DateTimeField('创建时间', auto_now_add=True)
    updateTime = models.DateTimeField('更新时间', auto_now=True)
    reqHost = models.CharField('域名', default=0, max_length=254, blank=True)
    reqPort = models.CharField('端口', default=0, max_length=254, blank=True)
    reqScheme = models.CharField('协议版本', default=0, max_length=254, blank=True)
    reqHeaderCntentType = models.TextField('请求头类型', default=0, blank=True)
    reqPath = models.CharField('链接', default=0, max_length=254, blank=True)
    reqUrl = models.CharField('url', default=0, max_length=254, blank=True)
    reqMethod = models.CharField('请求方法', default=0, max_length=254, blank=True)
    reqQuery = models.TextField('请求入参', default=0,  blank=True)
    reqContent = models.TextField('请求内容', default=0, blank=True)
    reqUrlencodedForm = models.TextField('表单', default=0,  blank=True)
    reqMultipartForm = models.TextField('表单2', default=0,  blank=True)
    reqPathComponents = models.CharField('url路径', default=0, max_length=254, blank=True)
    ReqReferer = models.TextField('refer', default=0, max_length=254, blank=True)

    statusCode = models.CharField('状态码', default=0, max_length=254, blank=True)
    # cookies = models.TextField('cookie', default=0, max_length=254, blank=True)
    reason = models.CharField('reason', default=0, max_length=254, blank=True)
    json = models.TextField('json', default=0, blank=True)
    # text = models.TextField('text', default=0,  blank=True)
    batch = models.CharField('批次', max_length=254, default='')
    # resData = models.TextField('返回数据', default=0,  blank=True)
    # resHeader = models.TextField('返回头', default=0,  blank=True)

    version = models.CharField('版本', default=0, max_length=254, blank=True)
    isDelete = models.BooleanField('是否删除', default=False)
    isValid = models.BooleanField('是否有效', default=True)
    decribe = models.CharField('描述', max_length=254, default='')
    roleType = models.IntegerField('类型', default=1)
    level = models.IntegerField('等级', default=1)
    score = models.IntegerField('分数', default=0)



